package com.aspose.cells;

public class ConditionalFormattingValue {
   private byte[] c;
   double a = -1.7976931348623157E308D;
   double b = Double.MAX_VALUE;
   private Object d = null;
   private int e;
   private boolean f = true;
   private FormatCondition g;

   void a(ConditionalFormattingValue var1, WorksheetCollection var2, WorksheetCollection var3, CopyOptions var4, int var5, int var6) {
      this.d = var1.d;
      this.f = var1.f;
      this.e = var1.e;
      if (var1.c != null) {
         this.c = zyd.a(var2, var3, var1.c, -1, var5, var6);
         if (var4 != null && !var4.a && var4.d != null) {
            zyo.b(this.c, -1, this.c.length, var4.d, var3);
         }
      }

   }

   ConditionalFormattingValue(FormatCondition fc) {
      this.g = fc;
   }

   ConditionalFormattingValue(FormatCondition formatCondition, int type, Object value) {
      this.g = formatCondition;
      this.setValue(value);
      this.e = type;
   }

   public Object getValue() {
      if (this.d != null) {
         return this.d;
      } else {
         this.b();
         return this.d;
      }
   }

   public void setValue(Object value) {
      this.d = value;
      this.c = null;
   }

   void a(double var1) {
      this.d = var1;
   }

   void a() {
      if (this.d != null) {
         if (this.d instanceof String && ((String)this.d).startsWith("=")) {
            String var1 = (String)this.d;
            int[] var4 = this.g.a.e();
            if (var4 != null) {
               int var2 = var4[0];
               int var3 = var4[1];
               this.c = this.g.e().x().a(-1, var1, var2, var3, 0, 64, true, true, false);
            }
         } else {
            this.c = zyo.a(this.g.e(), this.d);
         }

      }
   }

   void b() {
      if (this.c != null) {
         if (this.g.e().n().k()) {
            if (this.c.length == 4) {
               return;
            }
         } else if (this.c.length == 2) {
            return;
         }

         this.d = zyo.a(this.g.e(), this.c, -1);
         if (this.d == null) {
            int[] var3 = this.g.a.e();
            if (var3 == null) {
               return;
            }

            int var1 = var3[0];
            int var2 = var3[1];
            this.d = this.g.e().b().a(-1, this.c, var1, var2, true);
         }

      }
   }

   String c() {
      if (this.c == null) {
         if (this.d == null) {
            return null;
         } else if (this.d instanceof String) {
            String var5 = (String)this.d;
            return var5.startsWith("=") ? var5.substring(1) : var5;
         } else {
            return com.aspose.cells.b.a.zr.a(this.d);
         }
      } else {
         int[] var3 = this.g.a.e();
         if (var3 == null) {
            var3 = new int[2];
         }

         int var1 = var3[0];
         int var2 = var3[1];
         String var4 = this.g.e().b().a(-1, this.c, var1, var2, true);
         return var4.substring(1);
      }
   }

   void a(String var1) {
      String var2 = "=" + var1;
      int[] var5 = this.g.a.e();
      if (var5 == null) {
         var5 = new int[2];
      }

      int var3 = var5[0];
      int var4 = var5[1];
      this.a(this.g.e().x().a(-1, var2, var3, var4, 0, 64, true, true, false));
   }

   double d() {
      if (this.d == null) {
         return 0.0D;
      } else if (this.d instanceof Integer) {
         return (double)(Integer)this.d;
      } else if (this.d instanceof Double) {
         return (Double)this.d;
      } else {
         return this.d instanceof DateTime ? CellsHelper.getDoubleFromDateTime((DateTime)this.d, this.g.e().n().getSettings().getDate1904()) : 0.0D;
      }
   }

   boolean e() {
      if (this.c != null) {
         Object var1 = zyo.a(this.g.e(), this.c, -1);
         return var1 == null || !(var1 instanceof Double);
      } else {
         return this.d != null && this.d instanceof String && ((String)this.d).startsWith("=");
      }
   }

   byte[] f() {
      if (this.c == null) {
         this.a();
      }

      return this.c;
   }

   void a(byte[] var1) {
      this.c = var1;
      this.d = zyo.a(this.g.e(), var1, -1);
   }

   void a(boolean var1, int var2, int var3) {
      if (this.c != null) {
         this.c = zcs.a(var1, this.c, -1, var2, var3, true);
      }

   }

   public int getType() {
      return this.e;
   }

   public void setType(int value) {
      this.e = value;
      if (value == 1 || value == 2) {
         this.d = null;
      }

   }

   public boolean isGTE() {
      return this.f;
   }

   public void setGTE(boolean value) {
      this.f = value;
   }
}
